<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <title>登录页面</title>
    <style>
        ul li{
            list-style: none;
            margin-top: 10px;
        }
        .loginDiv , .regDiv{
            width: 50%;
            margin:  0 auto;
            background-color: goldenrod;
        }
        .divDis{
            display: none;
        }
    </style>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.cookie.js"></script>
    <script src="../js/layer/layer.js"></script>
    <script src="../js/common.js"></script>
</head>
<body>
<div class="loginDiv">
    <ul>
        <li><span>用户名:</span><input type="text" id="userName"  /></li>
        <li><span>密码:</span><input type="password" id="pwd"  /></li>
        <li><input type="button" id="loginBtn" value="登录" /></li>
    </ul>
</div>
</body>
<script>
    $(function(){
        $("#loginBtn").click(function(){
            var userName = $("#userName").val();
            var pwd = $("#pwd").val();
            $.ajax({
                url:baseUrl+"login.json",
                contentType:"json",
                data:{
                  userName:userName,
                  pwd:pwd
                },
                success:function(data){
                    if(data.flag == "ok"){
                        $.cookie("USER", userName, {
                            path: "/"
                        });
                        window.location.href = getUrlParam("targetUrl");
                    }else{
                        layer.msg("账户名密码错误!",{icon:5});
                    }
                }
            })
        });
    })
</script>
</html>
